package com.example.login_register;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class LogonActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_logon);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });

        TextView tv_1 = findViewById(R.id.tv_1);
        TextView tv_account = findViewById(R.id.tv_account);
        TextView tv_password = findViewById(R.id.tv_password);
        Button btn_1 = findViewById(R.id.btn_1);

        Intent intent = getIntent();
        String account = intent.getStringExtra("account");
        String password = intent.getStringExtra("password");
        tv_account.setText(account);
        tv_password.setText(password);
        tv_1.setOnClickListener(v ->
        {
            finish();
        });
        btn_1.setOnClickListener(v ->
        {
            Intent intent1 = new Intent();
            intent1.putExtra("main_data","接收到了账号和密码");
            setResult(2,intent1);
            finish();
        });
    }
}